﻿<!DOCTYPE html>
<html>
	<head>

        <title>旅客信息</title>
		<meta charset="utf-8"/>
		<link rel="stylesheet" type="text/css" href="iconfont/iconfont.css">
		<link rel="stylesheet" type="text/css" href="css/nanhang.css">
		<link rel="stylesheet" type="text/css" href="css/booking.css">
        <script type="text/javascript" src="../static/jquery-easyui-1.3.3/jquery.min.js"></script>
		<script type="text/javascript" src="IIInsomniaCityPicker/js/jquery.cookie.js"></script>

		<script src="js/top.js"></script>
		<script src="js/nanhang.js"></script>
		<script src="js/addChengJiRen.js"></script>
     <script>
         <!--从URL获取传递的参数并赋给对应的Span-->
         $(function(){

             $('#Or_deptCity').text(GetQueryString("deptCity"));
             $('#Or_arrCity').text(GetQueryString("arrCity"));
             $('#Or_flightNo').text(GetQueryString("flightNo"));
             $('#Or_flightDate_Arr_Time').text(GetQueryString("flightDate_Arr_Time"));
             $('#Or_flightDate_Arr_Date').text(GetQueryString("flightDate_Arr_Date"));
             $('#Or_flightDate_Dept_Date').text(GetQueryString("flightDate_Dept_Date"));
             $('#Or_flightDate_Dept_Time').text(GetQueryString("flightDate_Dept_Time"));
             $('#Or_flightCabin').text(GetQueryString("flightCabin"));
             var i=	getElementsByClassName("cjrxx").length;

             $('#Or_flightprice').text(GetQueryString("flightprice")*i);



         });

         function GetQueryString(name)
         {
                 var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
                 var URL =  decodeURI(window.location.search);
                 var r = URL.substr(1).match(reg);
                 if(r!=null)return  unescape(r[2]); return null;
         };
     </script>

	</head>
	<body>
		<div class="container">
			
			<div class="middle">
				<div class="con">
					<div class="plan">
						<div class="dot"></div>
						<ul>
							<li>
								<div>
									1
								</div>
								<span>航班查询</span>
								<div></div>
							</li>
							<li>
								<div>
									2
								</div>
								<span>航班选择</span>
								<div></div>
							</li>
							<li class="active">
								<div>
									3
								</div>
								<span>旅客信息</span>
								<div></div>
							</li>
							<li>
								<div>
									4
								</div>
								<span>支付订单</span>
								<div></div>
							</li>
							<li>
								<div>
									5
								</div>
								<span>完成支付</span>
							</li>
						</ul>
						<div class="clear"></div>
					</div>
					<div class="hbxx">
						<p class="hbxx_1"><span class="hbxx_11">航班信息</span></p>
						<div class="hbxx_2">
							<div class="hbxx_2_left">
								<div class="hbxx_2_left1">
									单程
								</div>
								<div class="hbxx_2_left2">
									<ul>
										<li class="hbxx_2_left21">
											<span class="flight_city" id="Or_deptCity">
                                                广东
												<span id="Or_flightDate_Dept_Time">11:55</span>
											</span>
											<br/>
											<span class="flight_date" id="Or_flightDate_Dept_Date">
												2017-08-30
											</span>
										</li>
										<li class="hbxx_2_left22">
											<span class="flight_code" id="Or_flightNo">
												cz6106
											</span>
										</li>
										<li class="hbxx_2_left21">
											<span class="flight_city" id="Or_arrCity">
                                                上海
												<span id="Or_flightDate_Arr_Time">19:35</span>
											</span>
											<br/>
											<span class="flight_date" id="Or_flightDate_Arr_Date">
												2017-08-30
											</span>
										</li>
										<li class="hbxx_2_left23">
											<p id="Or_flightCabin">Y</p>
										</li>
									</ul>
								</div>
								<div class="hbxx_2_left3">
									<a href="#">修改航班</a>
								</div>
								<div class="clear"></div>
							</div>
							<div class="hbxx_2_right">
								<div >
									<ul>
										<li>旅客</li>
										<li class="pjxq">成人X1</li>
									</ul>
									<ul>
										<li>票价</li>
										<li class="pjxq">&yen;1120</li>
									</ul>
									<ul>
										<li>燃油费</li>
										<li class="pjxq">&yen;0</li>
									</ul>
									<ul>
										<li>机场税</li>
										<li class="pjxq">&yen;50</li>
									</ul>
									<ul>
										<li>保险费</li>
										<li class="pjxq">&yen;0</li>
									</ul>
								</div>
							</div>
						</div>
						<div class="zj"><p>总价&nbsp;<span id="Or_flightprice">&yen;1170</span></p></div>
					</div>
					<div>
					<div class="cjrxx">
						<p class="cjrxx_1"><span class="cjrxx_11">乘机人信息</span></p>
						<div>
							<p class="nr_1">
								<select name="" class="sel-human" id="selHuman0">
									<option value="1">成人(&ge;12)</option>
								</select>
								<span style="color:red">*</span>姓&nbsp;名
								<input class="nr_12 uname" id="uname0" type="text" />
								<i></i>
							</p>

							<p class="nr_1">
								<span style="color:red">*</span>证&nbsp;&nbsp;件
								<select name="" id="zjlx0" class="sel-code">
									<option value="1" selected>身份证</option>
									<option value="2">护照</option>
									<option value="3">其他证件</option>
								</select>
								<input class="nr_12 ucode" id="code0" type="text" />
								<i></i>
							</p>
						</div>
						<div class="clear"></div>
						<div class="cjrxx_2">
							<div class="cjrxx_21">保&nbsp;险</div>
							<div class="cjrxx_22">
								<div class="cjrxx_23">
									<label  for="ir_00">
										<span><input type="checkbox" id="ir_00"/>航空综合险</span>
										<span class="cjrxx_organ1">&yen;<span class="cjrxx_organ11">30</span>&frasl;份</span>
										<i></i>
										<span class="cjrxx_organ2">最高赔付&yen;200万<span class="cjrxx_organ21">(含财产损失、意外保险、航班延误等项目)</span></span>
									</label>
								</div>
								<div class="cjrxx_23">
									<label  for="ir_01">
										<span><input type="checkbox" id="ir_01"/>机票退票险</span>
										<span class="cjrxx_organ1">&yen;<span class="cjrxx_organ11">38</span>&frasl;份</span>
										<span class="cjrxx_organ2">所购机票因退票产生的退票费<span class="cjrxx_organ21">(赔偿50%退票费，封顶2,000元)</span></span>
									</label>
								</div>
							</div>
							<div class="clear"></div>
						</div>
					</div>
					</div>
					<div class="tjcjr">
						<button class="tjcjr_1">添加新乘机人</button>
						<button class="tjcjr_2">删除新乘机人</button>
					</div>
					<div class="lxrxx">
						<p class="lxrxx_1"><span class="lxrxx_11">联系人信息</span></p>
						<div class="lxrxx_2">
							<lable>
								<span style="color:red">*</span> 姓&nbsp;&nbsp;&nbsp;名
								<input  id="booking_linkInfo_name" type="text" />
							</lable>
							<lable class="lxrxx_21">
								<span style="color:red">*</span>手机号
								<input id="booking_linkInfo_phone"class="nr_12" type="text" />
								&nbsp;&nbsp;用于接收航班信息、管理订单
							</lable>
						</div>
						<div class="lxrxx_3">
							<span style="color:red">*</span> E-mail
							<input  id="booking_linkInfo_email" type="text" />
						</div>
					</div>
					<div class="sjcw" >
						<div class="sjcw_1"></div>
						<div class="sjcw_2">升级舱位<span class="sjcw_21">让旅行更舒适</span></div>
						<div class="sjcw_3">什么是升级舱位</div>
						<div class="clear"></div>
					</div>
					<div class="ydtk">
						<input type="checkbox"/>已阅读并理解
						<a href="">《旅客购票须知》</a>
						<a href="">《锂电池运输规定》</a>
						<a href="">《客票行李规定》</a>
						<a href="">《国内运输总条件》</a>
					</div>
					<div class="sx">
						<button class="sx_1">上一步</button>
						<button onclick="order_transmit()" class="sx_2">下一步</button>
					</div>
				</div>
			</div>
		</div>
		<footer>
			<div class="footerL">Copyright(C)1997-2017 中国南方航空股份有限公司 版权所有 粤ICP备05053330号</div>
			<div class="footerR">
				<a href="">关于南航｜</a>
				<a href=""> 投资者关系｜</a>
				<a href=""> 预订须知 ｜</a>
				<a href=""> 常见问题 ｜</a>
				<a href=""> 联系我们｜ </a>
				<a href=""> "十分"关爱基金会</a>
			</div>
			<div class="clear"></div>
		</footer>
	</body>
</html>

<script>
	function order_transmit() {
        var booking_linkInfo_name = document.getElementById("booking_linkInfo_name").value;
        var booking_linkInfo_phone = document.getElementById("booking_linkInfo_phone").value;
        var booking_linkInfo_email = document.getElementById("booking_linkInfo_email").value;
        var Or_deptCity = document.getElementById("Or_deptCity").innerHTML;
        var Or_arrCity = document.getElementById("Or_arrCity").innerHTML;
        var Or_flightNo = document.getElementById("Or_flightNo").innerHTML;
//        var Or_flightDate_Arr_Time = document.getElementById("Or_flightDate_Arr_Time").innerHTML;
        var Or_flightDate_Arr_Date = document.getElementById("Or_flightDate_Arr_Date").innerHTML;
        var Or_flightDate_Dept_Date = document.getElementById("Or_flightDate_Dept_Date").innerHTML;
//        var Or_flightDate_Dept_Time = document.getElementById("Or_flightDate_Dept_Time").innerHTML;
        var Or_flightCabin = document.getElementById("Or_flightCabin").innerHTML;
        var Or_flightprice = (document.getElementById("Or_flightprice").innerHTML);

        var i=	getElementsByClassName("cjrxx").length;

        var arrayName = new Array();
        var arrayCode = new Array();
        var arrayZjlx = new Array();
        for (j=0;j<i;j++) {
            var unmae = 'uname'+j;
            var pushuname=document.getElementById(unmae).value;
            arrayName.push(pushuname);

            var zjlx = 'zjlx'+j;
            var pushzjlx=document.getElementById(zjlx).value;
            arrayZjlx.push(pushzjlx);

            var code = 'code'+j;
            var pushcode=document.getElementById(code).value;
            arrayCode.push(pushcode);
        }
        $.ajax({
            url:"/order/AddBooking",
            type:"post",
            dataType:"json",
            data:{
                'arrayName':arrayName,
                'arrayCode':arrayCode,
                'arrayZjlx':arrayZjlx,
                'booking_linkInfo_name':booking_linkInfo_name,
                'booking_linkInfo_phone':booking_linkInfo_phone,
                'booking_linkInfo_email':booking_linkInfo_email,
                'deptCity':Or_deptCity,
                'arrCity':Or_arrCity,
                'flightNo':Or_flightNo,
//                'flightDate_Arr_Time':Or_flightDate_Arr_Time,
                'flightDate_Arr_Date':Or_flightDate_Arr_Date,
                'flightDate_Dept_Date':Or_flightDate_Dept_Date,
//                'flightDate_Dept_Time':Or_flightDate_Dept_Time,
                'flightCabin':Or_flightCabin,
                "flightprice":Or_flightprice


            },
            success:function(order){
                 if (order.id!=null){
                      alert("创建订单成功");
                     window.open("/front/order.html?orderid="+order.id+"&flightprice="+order.price)
                 }else{
                     alert("创建订单失败");
                 }
            }
        });

    }



//    获取div数量
    function getElementsByClassName(n) {
        var classElements = [],allElements = document.getElementsByTagName('div');//所有div
        for (var i=0; i< allElements.length; i++ )
        {
            if (allElements[i].className == n ) {
                classElements[classElements.length] = allElements[i];
            }
        }
        return classElements;
    }

</script>